var express = require('express');
var router = express.Router();

module.exports = ((req, res, next) => {
    const url = req.originalUrl;
    const url_first = url.split('/')[1];
    // 不需要进行验证的api
    var urlArr = ['login']
    var is_next = urlArr.find(item => item === url_first)
    if (is_next) {
        next()
        return false
    }

    const token = req.headers['authorization']
    switch(true) {
        case token === '':
            return res.status(401).json({
                msg: 'wdnmd token 呢'
            })
        default:
    }
    next();
});
